import request from '../request'

// 分页查询权限审计日志
export function getAuditLogPage(params) {
  return request.get('/property/audit-logs', { params })
}

// 根据用户ID查询权限审计日志
export function getAuditLogsByUserId(userId, limit = 10) {
  return request.get(`/property/audit-logs/user/${userId}`, { params: { limit } })
}

// 根据操作类型查询权限审计日志
export function getAuditLogsByOperation(operation, limit = 10) {
  return request.get(`/property/audit-logs/operation/${operation}`, { params: { limit } })
}

// 获取权限审计统计信息
export function getAuditStatistics(params) {
  return request.get('/property/audit-logs/statistics', { params })
}

// 获取权限异常统计信息
export function getExceptionStatistics(params) {
  return request.get('/property/audit-logs/exception-statistics', { params })
}

// 清理过期审计日志
export function cleanExpiredLogs(data) {
  return request.post('/property/audit-logs/clean-expired', data)
}

// 导出权限审计日志
export function exportAuditLogs(params) {
  return request.post('/property/audit-logs/export', params)
}

// 获取权限审计日志详情
export function getAuditLogDetail(logId) {
  return request.get(`/property/audit-logs/${logId}`)
}

// 批量删除权限审计日志
export function batchDeleteAuditLogs(logIds) {
  return request.delete('/property/audit-logs/batch', { data: logIds })
}

// 获取用户权限操作统计
export function getUserOperationStatistics(userId, days = 30) {
  return request.get(`/property/audit-logs/user-statistics/${userId}`, { params: { days } })
}

// 获取权限审计日志趋势分析
export function getAuditTrendAnalysis(params) {
  return request.get('/property/audit-logs/trend-analysis', { params })
} 